import java.util.Calendar;

/**
 * ClassName: Java_Cal_Test
 * Package: PACKAGE_NAME
 * DESCRIPTION:
 *
 * @Author 程翎钥
 * @Create 2024/4/9 17:01
 * @Version 1.0
 */
public class Java_Cal_Test {
    public static void main(String[] args) {
        System.out.println("一\t二\t三\t四\t五\t六\t日");
        Calendar firstDate = Calendar.getInstance();
        firstDate.set(Calendar.DAY_OF_MONTH,1);
        int maxDay = firstDate.getActualMaximum(Calendar.DAY_OF_MONTH);
        //System.out.println(maxDay);
        for (int i = 0;i < maxDay;i++){
            int weekX = firstDate.get(Calendar.DAY_OF_WEEK);
            int monthY = firstDate.get(Calendar.DAY_OF_MONTH);
            if (i !=0){
                if (weekX == Calendar.SUNDAY){
                    System.out.println(monthY);
                }else {
                    System.out.print(monthY + "\t");
                }
            }else {
                if (weekX == Calendar.SUNDAY){
                    for (int j=0;j<6;j++){
                        System.out.println("\t");
                    }
                    System.out.println(monthY);
                }else {
                    for (int j=0;j<weekX-2;j++){
                        System.out.print("\t");
                    }
                    System.out.print(monthY + "\t");
                }
            }
            firstDate.add(Calendar.DATE,1);
        }

    }
}
